package com.xin.web;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.xin.entity.SDictCommon;
import com.xin.service.SDictCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 通用字典库 前端控制器
 * </p>
 *
 * @author l1
 * @since 2017-10-20
 */
@Controller
public class SDictCommonController {

    @Autowired
    private SDictCommonService sDictCommonService;

    /**
     * 根据不同的id获取不同的字典数据
     *
     */
    @GetMapping("/dictCommon/{flag}")
    public List<SDictCommon> findDict(@PathVariable("flag") String flag){

        return sDictCommonService.selectList(new EntityWrapper<SDictCommon>()
                .eq("flag",flag)
                .orderBy("show_order",true));
    }
}
